import React, { memo, useState } from "react";
const Pure = memo(
  () => {
    return <div />;
  },
  (preProps, nextProps) => {
    console.log("arr", preProps.arr === nextProps.arr);
  }
);
const Equal = () => {
  const [arr, setArr] = useState([]);
  const store = {
    user: {
      xiaomin: {
        name: "xiaomin",
      },
      xiaohua: {
        name: "xiaohua",
      },
    },
  };
  const userProps = store.user;
  const newUserProps = {
    ...userProps,
    xiaomin: {
      name: "xiaomin1",
    },
  };
  console.log("userProps", userProps === newUserProps);
  console.log('xiaoMingProps',userProps.xiaomin === newUserProps.xiaomin)
  console.log('xiaoHuaProps',userProps.xiaohua === newUserProps.xiaohua)
  return (
    <div>
      <button
        onClick={() => {
          setArr((arr) => {
            // 1. array push
            arr.push(1);
            return arr;
          });
        }}
      >
        Equal: click
      </button>
      <Pure arr={arr} />
    </div>
  );
};
export default Equal;
